<ul class="buttons">
  <li><%= image_tag_for_key('arrow_left', publication_path(@publication), 'Return to publication', nil, 'Return to publication') -%></li>
</ul>

<h1>Edit publication: <%= link_to(h(@publication.title), publication_path(@publication)) -%></h1>
<div class="show_basic">    
  <%= error_messages_for('publication', :message => nil) %>
  <% form_tag publication_path(@publication), :method => :put do %>
    <!-- <p> -->
      <!-- <label>Project:</label><br/> -->
      <%#= collection_select :publication, :project_id, Project.all,:id,:name,{ :include_blank => "None" }%>
    <!-- </p> -->
    
    <% if @publication.pubmed_id.nil? && @publication.doi %>
      <p>
        <label>Abstract:</label><br/>
        <%= text_area(:publication, :abstract, :cols => 90, :rows => 8) %>
      </p>
    <% end %>
    
    
    <h2>Associate authors</h2>  
 
    <%# project = @publication.project %>
    Using the form below, you can link the authors listed in PubMed to people registered in MethodBox.<br/><br/>
    
    MethodBox will try and suggest the correct person based on the author's name. If this suggestion is incorrect, please select the correct person from the dropdown menu, or choose "None" if this person isn't a member of MethodBox.<br/><br/>
    
    To reset the author list to the state of the original PubMed article, click the "Disassociate All Authors".<br/>
    
    <div style="margin:1em; float: left; width:45%" class="box_editing_inner">
      <h4>Unassociated authors</h4>
      <% unless @publication.non_seek_authors.empty? %>
        <table>
          <tr>
            <th>Author name</th>
            <th>MethodBox person</th>
          </tr>
          <% @publication.non_seek_authors.each do |author| %>
          <tr>    
            <td><%= author.last_name + " " + author.first_name -%></td>
            <td><select name="author[<%= author.id -%>]"><option value="">None</option>
	<% if (@author_associations[author.id] != nil) %>
	<option value="<%= @author_associations[author.id].id -%>">
<%= @author_associations[author.id].name -%>
</option>
<% end -%>
</select></td>
          </tr>
          <% end %>
        </table>
      <% else %>
        <span class="none_text">No unassociated authors</span>
      <% end %>
    </div>
    
    <div style="margin:1em; float: left; width:35%" class="box_editing_inner">
      <h4>Associated authors</h4>
      <% unless @publication.asset.creators.empty? %>
        <ul class="related_asset_list">
          <% @publication.asset.creators.each do |creator| %>
            <li><%= (link_to get_object_title(creator), show_resource_path(creator.person)) %></li>
          <% end %>
        </ul>
        <br/>
        <ul class="sectionIcons"><li><%= image_tag_for_key('no_user', disassociate_authors_publication_url(@publication), "Disassociate All Authors", {:confirm => "This will reset the publication's links to people in MethodBox, are you sure you wish to do this?", :method => :post}, "Disassociate All Authors") -%></li></ul>
      <% else %>
        <span class="none_text">No associated authors</span>
      <% end %>
    </div>
    
    
    <br style="clear: both"/>
  
    <p style="text-align: center;">
      <%= submit_tag 'Update' %>
    </p>
  <% end %>
</div>